package com.xbongbong.pro.form.pojo;

import com.xbongbong.paas.field.LinkListPojo;
import com.xbongbong.pro.custombutton.pojo.CustomButtonActionPojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * @author feng.zheng
 * @version v1.0
 * @date 2019/4/15 16:36
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class TopPermissionsPoJo implements Serializable {

    private static final long serialVersionUID = 3916185808449806770L;
    /**
     * 按钮的唯一键
     */
    private String attr;

    private String value;

    private Integer businessType;

    /**
     * @see com.xbongbong.saas.enums.SaasButtonEnum
     */
    private String btnType;

    private String icon;

    private String actions;

    private Long formId;

    /**
     * 关联列表的属性
     */
    private LinkListPojo linkList;


    /**
     * 低代码，按钮动作
     */
    private List<CustomButtonActionPojo> actionList;

    /**
     * 经销商标识
     */
    private Integer distributorMark;

    private String text;

    public TopPermissionsPoJo() {

    }

    public TopPermissionsPoJo(String attr) {
        this.attr = attr;
    }

    public TopPermissionsPoJo(String attr, String value, Integer businessType, String btnType) {
        this.attr = attr;
        this.value = value;
        this.businessType = businessType;
        this.btnType = btnType;
    }

    public TopPermissionsPoJo(String attr, String value, Integer businessType, String btnType, Integer distributorMark) {
        this.attr = attr;
        this.value = value;
        this.businessType = businessType;
        this.btnType = btnType;
        this.distributorMark = distributorMark;
    }


    public TopPermissionsPoJo(Integer businessType, String attr, String value, String btnType, Integer distributorMark, LinkListPojo linkList, List<CustomButtonActionPojo> actionList) {
        this.attr = attr;
        this.value = value;
        this.businessType = businessType;
        this.btnType = btnType;
        this.linkList = linkList;
        this.actionList = actionList;
        this.distributorMark = distributorMark;
    }

    /**
     * 以下是建造者模式方法
     *
     * @param builder
     */
    public TopPermissionsPoJo(Builder builder) {
        this.attr = builder.attr;
        this.value = builder.value;
        this.businessType = builder.businessType;
        this.btnType = builder.btnType;
    }

    public static class Builder{
        private String attr;
        private String value;
        private Integer businessType;
        private String btnType;
        public Builder attr(String attr){
            this.attr = attr;
            return this;
        }
        public Builder value(String value){
            this.value = value;
            return this;
        }
        public Builder businessType(Integer businessType){
            this.businessType = businessType;
            return this;
        }
        public Builder btnType(String btnType){
            this.btnType = btnType;
            return this;
        }

        public TopPermissionsPoJo build(){
            return new TopPermissionsPoJo(this);
        }
    }


}
